// @ts-ignore
import Queue from './Queue-Array.ts'

/**
 * 击鼓传花 约瑟夫环
 * @param nums
 * @param count
 */
const getWinner = (nums: number, count: number) => {
  const que = new Queue<number>()
  for (let i = 0; i < nums; i++) {
    que.enQueue(i)
  }

  while (que.size() > 1) {
    for (let i = 1; i < count; i++) {
      const element = que.deQueue()
      que.enQueue(element!)
    }
    que.deQueue()
  }

  return que.peek()
}



